﻿using System;
using EnvDTE;
using EnvDTE80;

namespace VsTortoiseSVN.Commands
{
    public class ActiveDocumentResolve : ActiveDocumentBase
    {
        public ActiveDocumentResolve(DTE2 application, string id)
            : base(application, id)
        {
        }

        public override vsCommandStatus QueryStatus()
        {
            if (Application.HasDocument())
            {
                SvnHelperStatusBools statuses = SvnHelperStatusBools.CreateConflicted();

                if (SvnHelper.HasLocalTextStatus(FullName, statuses))
                    return vsCommandStatus.vsCommandStatusSupported | vsCommandStatus.vsCommandStatusEnabled;
            }

            return vsCommandStatus.vsCommandStatusUnsupported;
        }

        public override bool Exec()
        {
            TortoiseProc.Resolve(FullName);
            return true;
        }
    }
}
